#include "istream.h"
#include <string.h>

namespace gecko
{

	// -----------------------------------------------------------------------------------------------

	size_t IStream::Serialise( char* buffer, size_t len )
	{
		return SerialiseBuffer(buffer, len);
	}

	// -----------------------------------------------------------------------------------------------

	size_t IStream::SerialiseString( char* str )
	{
		size_t bytesSerialised = 0;
		unsigned short stringLen = 0;

		if (m_mode == ModeWrite)
		{
			stringLen = (unsigned short)strlen(str) + 1;
		}
		
		bytesSerialised += Serialise(stringLen);
		bytesSerialised += Serialise(str, stringLen);

		return bytesSerialised;
	}

	// -----------------------------------------------------------------------------------------------

	IStream::eMode IStream::GetMode()
	{
		return m_mode;
	}

}
